//
//  MvTableViewCell.m
//  23-QQMusic
//
//  Created by dllo on 16/8/15.
//  Copyright © 2016年 ZHW. All rights reserved.
//

#import "MvTableViewCell.h"
#import "MvCollectionViewCell.h"
#import "List.h"
#import "MvList.h"
#define kCollectionViewReuse @"collectionReuse"
@interface MvTableViewCell ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@property (weak, nonatomic) IBOutlet UICollectionView *mvCollectionView;
@end
@implementation MvTableViewCell

- (void)setMvListArray:(NSArray<MvList *> *)mvListArray {
    _mvListArray = mvListArray;
    [_mvCollectionView reloadData];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.item == 0) {
        return CGSizeMake(CGRectGetWidth(collectionView.bounds), CGRectGetHeight(collectionView.bounds) / 2);
    } else {
        return CGSizeMake((CGRectGetWidth(collectionView.bounds) - 5) / 2, CGRectGetHeight(collectionView.bounds) / 4);
    }
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return _mvListArray.count;
}

- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    MvCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCollectionViewReuse forIndexPath:indexPath];
    cell.mvList = self.mvListArray[indexPath.row];
    return cell;
}

@end
